home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / Sample Editors⁄Viewers / Cappuccino / Source / Cappuccino.r < prev    next >
Encoding:
Text File  |  1995-12-11  |  15.0 KB  |  679 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Cappuccino.r
  3.  
  4.     Contains:    Cappuccino Resources
  5.  
  6.     Written by:    Steve Smith and Troy Gaul
  7.  
  8.     Copyright:    © 1994 - 1995 by Apple Computer, Inc., all rights reserved.
  9. */
  10.  
  11. #define SystemSevenOrBetter 1            // we want the extended types
  12. #define    SystemSevenOrLater    1            // Types.r uses this variable
  13.  
  14. #define qRezzing 1                        // Flag for our Def file.
  15.  
  16. // -- MPW Rez Includes --
  17.  
  18. #include "Types.r"
  19. #include "SysTypes.r"
  20. #include "CodeFragmentTypes.r"
  21.  
  22. // -- OpenDoc Includes --
  23.  
  24. #ifndef __ODTYPES_R__
  25. #include "ODTypes.r"
  26. #endif
  27.  
  28. #ifndef SOM_Module_OpenDoc_StdDefs_defined
  29. #include "StdDefs.r"
  30. #endif
  31.  
  32. // -- Cappuccino Includes --
  33.  
  34. #ifndef _CAPPUCCINODEF_
  35. #include "CappuccinoDef.h"
  36. #endif
  37.  
  38. #ifndef _CAPPUCCINOVERS_
  39. #include "CappuccinoVers.h"
  40. #endif
  41.  
  42. //------------------------------------------------------------------------------
  43. // .rsrc resources
  44. //------------------------------------------------------------------------------
  45.  
  46. // Cappuccino - This gets the resources from my .rsrc file (PICTs etc.)
  47. include "CappuccinoOtherResources.rsrc" not 'ckid';
  48.  
  49. // Since we use the Print Manager library, we need to includes its resources.
  50. include "PrintManager.rsrc" not 'ckid';
  51.  
  52. //------------------------------------------------------------------------------
  53. // AETE resources
  54. //------------------------------------------------------------------------------
  55.  
  56. #include "CappuccinoAETE.r"
  57. #include "CappuccinoBalloons.r"
  58.  
  59. //------------------------------------------------------------------------------
  60. // Finder Version Resources
  61. //------------------------------------------------------------------------------
  62.  
  63. // Part's Finder Version Resource
  64.  
  65. resource 'vers' (1) 
  66. {
  67.     currentMajorVersion,
  68.     finderMinorVersion,
  69.     developmentStage,
  70.     preReleaseNumber,
  71.     verUS,
  72.     shortVersionStr,
  73.     shortVersionStr", © Apple Computer, Inc. 1994-1995"
  74. };
  75.  
  76. resource 'vers' (2) 
  77. {
  78.     currentMajorVersion,
  79.     finderMinorVersion,
  80.     developmentStage,
  81.     preReleaseNumber,
  82.     verUS,
  83.     shortVersionStr,
  84.     "OpenDoc™ Sample Code"
  85. };
  86.  
  87. //------------------------------------------------------------------------------
  88. // Code Fragment Resources
  89. //------------------------------------------------------------------------------
  90.  
  91. resource 'cfrg' (0) 
  92. {
  93.     {    /* [1] */
  94. #ifdef _68KBUILD_
  95.         kMotorola,
  96. #else
  97.         kPowerPC,
  98. #endif
  99.         kFullLib,
  100.         currentVersion,
  101.         compatibleVersion,
  102.         kDefaultStackSize,
  103.         kNoAppSubFolder,
  104.         kIsLib,
  105.         kOnDiskFlat,
  106.         kZeroOffset,
  107.         kWholeFork,
  108.         kCappuccinoID,        // This must be the class ID.
  109.  
  110.         /* [2] */
  111. #ifdef _68KBUILD_
  112.         kMotorola,
  113. #else
  114.         kPowerPC,
  115. #endif
  116.         kFullLib,
  117.         currentVersion,
  118.         compatibleVersion,
  119.         kDefaultStackSize,
  120.         kNoAppSubFolder,
  121.         kIsLib,
  122.         kOnDiskFlat,
  123.         kZeroOffset,
  124.         kWholeFork,
  125.         kPartClassName        // This must be the SOM class name for this part.                   */
  126.     }
  127. };
  128.  
  129. //------------------------------------------------------------------------------
  130. // NMAP Resources
  131. //------------------------------------------------------------------------------
  132.  
  133. // Map a part's class id (module::classname)
  134. // to a part's kind (unique content identifier)
  135. resource kODNameMappings (kEditorKindMapId) 
  136. {
  137.     kODEditorKinds,
  138.     {    /* array Types: 1 elements */
  139.         /* [1] */
  140.         kCappuccinoID,
  141.         kODIsAnISOStringList
  142.         {
  143.             {    /* array ClassIDs: 1 elements */
  144.                 /* [1] */
  145.                 kCappuccinoKind
  146.             }
  147.         }
  148.     }
  149. };
  150.  
  151. // Map a part's class id (module::classname)
  152. // to a human readable string.
  153. resource kODNameMappings (kEditorUserStringMapId) 
  154. {
  155.     kODEditorUserString,
  156.     {    /* array Types: 1 elements */
  157.         /* [1] */
  158.         kCappuccinoID,
  159.         kODIsINTLText
  160.         {
  161.             smRoman,
  162.             langEnglish,
  163.             kCappuccinoEditorUserString
  164.         }
  165.     }
  166. };
  167.  
  168. // Map a part's kind (unique content identifier)
  169. // to a generic content category identifier.
  170. resource kODNameMappings (kKindCategoryMapId) 
  171. {
  172.     kODKind,
  173.     {    /* array Types: 1 elements */
  174.         /* [1] */
  175.         kCappuccinoKind,
  176.         kODIsAnISOStringList
  177.         {
  178.             {    /* array ClassIDs: 1 elements */
  179.                 /* [1] */
  180.                 kCappuccinoCategory
  181.             }
  182.         }
  183.     }
  184. };
  185.  
  186. // Map a part's kind (unique content identifier)
  187. // to a human readable string.
  188. resource kODNameMappings (kKindUserStringMapId) 
  189. {
  190.     kODKindUserString,
  191.     {    /* array Types: 1 elements */
  192.         /* [1] */
  193.         kCappuccinoKind,
  194.         kODIsINTLText
  195.         {
  196.             smRoman,
  197.             langEnglish,
  198.             kCappuccinoKindUserString
  199.         }
  200.     }
  201. };
  202.  
  203. // Map a part's generic content category identifier
  204. // to a human readable string.
  205. /*
  206.     // This nmap is not used because we (like a good part), use one
  207.     // of the standard categories listed in StdDefs.idl.
  208.  
  209. resource kODNameMappings (kCategoryUserStringMapId) 
  210. {
  211.     kODCategoryUserString,
  212.     {    // array KeyList: 1 elements
  213.         // [1]
  214.         kCappuccinoCategory,
  215.         kODIsINTLText {
  216.             smRoman,
  217.             langEnglish,
  218.             kCappuccinoCategoryUserString
  219.         }
  220.     }
  221. };
  222.  
  223. */
  224.  
  225. // Map a part's kind (unique content identifier)
  226. // to an old style MacOS Type (and/or ScrapType).
  227. resource kODNameMappings (kOldMacOSTypeMapId) 
  228. {
  229.     kODKindOldMacOSType,
  230.     {    /* array KeyList: 1 elements */
  231.         /* [1] */
  232.         kCappuccinoKind,
  233.         kODIsMacOSType {
  234.             kCappuccinoDocumentOSType
  235.         }
  236.     }
  237. };
  238.  
  239.  
  240. // Map a part's class id (module::classname) to
  241. // the data/file OSTypes the part supports.
  242. resource kODNameMappings (kPlatformEditorKindMapId) 
  243. {
  244.     kODEditorPlatformKind,
  245.     {    /* array KeyList: 1 element */
  246.         /* [1] */
  247.         kCappuccinoID,
  248.         kODIsPltfmTypeSpac {
  249.             /* array PltfmTypeSpacList: 3 elements */
  250.             {
  251.                 /* [1] */
  252.                 kODPlatformDataType, 
  253.                 kTextDataKind,
  254.                 smRoman,
  255.                 langEnglish,
  256.                 kTextDataKindUserString,
  257.                 kODCategoryPlainText,
  258.             }
  259.         }
  260.     }
  261. };
  262.  
  263. //------------------------------------------------------------------------------
  264. // OLE Interoperability Support
  265. //------------------------------------------------------------------------------
  266.  
  267. // This resource allows your editor to be registered with the OLE runtime on the
  268. // Macintosh and subsequently interoperate with OLE clients/servers. Contact Microsoft
  269. // to acqiure a unique class ID.
  270. resource 'olcr' (0, "OLE Class ID")
  271. {
  272.    "{80C11F40-7503-8576-00D01113F11}"; /* your part's CLSID */
  273. };
  274.  
  275. //------------------------------------------------------------------------------
  276. // String Resources
  277. //------------------------------------------------------------------------------
  278.  
  279. resource 'STR ' (kDefaultStringID) 
  280. {
  281.     "Cappuccino"
  282. };
  283.  
  284. resource 'STR#' (kMenuStringResID, "Menu item strings") 
  285. {
  286.     {    /* array StringArray: 1 element */
  287.         /* [1] */
  288.         "About Cappuccino…"
  289.     }
  290. };
  291.  
  292. //------------------------------------------------------------------------------
  293. // Error strings
  294. //------------------------------------------------------------------------------
  295.  
  296. resource 'STR#' (kErrorStringResID, "Error strings") 
  297. {
  298.     {    /* array StringArray: 6 elements */
  299.         /* [1] */
  300.         "“Cappuccino” was unable completely initialize "
  301.         "its internal structures.",
  302.         /* [2] */
  303.         "“Cappuccino” was unable to open the document "
  304.         "due to unforseen circumstances.",
  305.         /* [3] */
  306.         "“Cappuccino” was unable to open a part window "
  307.         "due to unforseen circumstances.",
  308.         /* [4] */
  309.         "“Cappuccino” has been asked to remove a "
  310.         "frame that does not belong to it, or an "
  311.         "error occurred while removing the frame "
  312.         "from internal storage.",
  313.         /* [5] */
  314.         "A window that “Cappuccino” created has been "
  315.         "deleted without its knowledge. This may "
  316.         "generate a fatal error in the near future. "
  317.         "Please close the document immediately to "
  318.         "prevent data loss.",
  319.         /* [6] */
  320.         "“Cappuccino” encountered a fatal error while "
  321.         "trying to save. Try saving again or closing "
  322.         "the document.",
  323.         /* [7] */
  324.         "You can’t edit content at a link destination. "
  325.         "You can either edit this content at its source or "
  326.         "break the link to edit it at the destination.",
  327.         /* [8] */
  328.         "The Speech Manager had encountered an error while "
  329.         "trying to speak the text.  Try closing other documents "
  330.         "or applications to increase available memory."
  331.     }
  332. };
  333.  
  334. //------------------------------------------------------------------------------
  335. // Undo/Redo strings
  336. //------------------------------------------------------------------------------
  337.  
  338. resource 'STR#' (kActionStringResID, "Action strings") 
  339. {
  340.     {
  341.         "Undo Cut",
  342.         "Redo Cut",
  343.         "Undo Paste",
  344.         "Redo Paste",
  345.         "Undo Clear",
  346.         "Redo Clear",
  347.         "Undo Drag",
  348.         "Redo Drag",
  349.         "Undo Drop",
  350.         "Redo Drop",
  351.         "Undo Set Text",
  352.         "Redo Set Text",
  353.         "Undo Change Settings",
  354.         "Redo Change Settings"
  355.     }
  356. };
  357.  
  358. //------------------------------------------------------------------------------
  359. // Finder Related Resources
  360. //------------------------------------------------------------------------------
  361.  
  362. // Kind resources affect the text Finder displays in the
  363. // "kind" column and file info dialog. This feature was
  364. // introduced as part of Macintosh Easy Open.
  365. //
  366. resource 'kind' (kBaseResourceID) 
  367. {
  368.     kCappuccinoEditorOSType,
  369.     0, /* region = USA */
  370.     {
  371.         'shlb', "OpenDoc™ editor"
  372.     }
  373. };
  374.     
  375. resource 'kind' (kBaseResourceID+1) 
  376. {
  377.     kCappuccinoViewerOSType,
  378.     0, /* region = USA */
  379.     {
  380.         'shlb', "OpenDoc™ viewer"
  381.     }
  382. };
  383.     
  384. resource 'kind' (kBaseResourceID+2) 
  385. {
  386.     kODShellSignature,
  387.     0, /* region = USA */
  388.     {
  389.         kCappuccinoDocumentOSType, "Cappuccino 1.0 document",
  390.         kCappuccinoStationeryOSType, "Cappuccino 1.0 stationery"
  391.     }
  392. };
  393.  
  394. // The -16397 string will be displayed by Finder when a user
  395. // tries to open the editor shared library. The string should
  396. // give the user a little detail about the part's capabilities
  397. // and enough information to install the part in the correct location.
  398. //
  399. resource 'STR ' (-16397, purgeable) 
  400. {
  401.     "OpenDoc™ editor\n\n“Cappuccino” demonstrates the functionality of a very "
  402.     "basic part. To work properly, it should be placed in the Editors folder. "
  403.     "To create a new document, open a stationery pad."
  404. };
  405.  
  406. //------------------------------------------------------------------------------
  407. // Dialog Resources
  408. //------------------------------------------------------------------------------
  409.  
  410. resource 'DLOG' (kAboutBoxID, "Cappuccino About Box") 
  411. {
  412.     {0, 0, 250, 350},
  413.     dBoxProc,
  414.     invisible,
  415.     goAway,
  416.     0x0,
  417.     kAboutBoxID,
  418.     "",
  419.     alertPositionMainScreen
  420. };
  421.  
  422. resource 'DITL' (kAboutBoxID) 
  423. {
  424.     {    /* array DITLarray: 8 elements */
  425.         /* [1] */
  426.         {222, 270, 242, 338}, Button { enabled, "OK" },
  427.         /* [2] */
  428.         {24, 25, 56, 57}, Icon { disabled, kEditorIconPicture },
  429.         /* [3] */
  430.         {13, 68, 237, 69}, Button { disabled, "" },
  431.         /* [4] */
  432.         {64, 13, 65, 337}, Button { disabled, "" },
  433.         /* [5] */
  434.         {46, 76, 62, 172}, StaticText { disabled, "Cappuccino" },
  435.         /* [6] */
  436.         {76, 76, 116, 304}, StaticText { disabled,
  437.             "Cappuccino is a sample part editor which "
  438.             "illustrates the functionality of a basic "
  439.             "part editor." },
  440.         /* [7] */
  441.         {124, 76, 152, 304}, StaticText { disabled,
  442.             "Written by Steve Smith and Troy Gaul with support from "
  443.             "the OpenDoc™ Engineering team." },
  444.         /* [8] */
  445.         {172, 76, 200, 300}, StaticText { disabled,
  446.             "Copyright © 1994 - 1995 by Apple Computer, Inc. "
  447.             "All Rights Reserved." },
  448.         /* [9] */
  449.         {51, 272, 64, 340}, StaticText { disabled,
  450.             "Version "shortVersionStr }
  451.     }
  452. };
  453.  
  454. resource 'dctb' (kAboutBoxID) 
  455. {
  456.     /* dialog background fill color */
  457.     {    /* array ColorSpec: 5 elements */
  458.         /* [1] */
  459.         wContentColor, 59127, 59127, 59127,
  460.         /* [2] */
  461.         wFrameColor, 0, 0, 0,
  462.         /* [3] */
  463.         wTextColor, 0, 0, 0,
  464.         /* [4] */
  465.         wHiliteColor, 0, 0, 0,
  466.         /* [5] */
  467.         wTitleBarColor, 65535, 65535, 65535
  468.     }
  469. };
  470.  
  471. data 'ictb' (kAboutBoxID) 
  472. {
  473.     /* dialog control text styling */
  474.     $"0000000000000000002800240028"
  475.     $"004C80070074800700888007009C"
  476.     $"800700B0800700C4000000000000"
  477.     $"000300007FFF7FFF7FFF0001FFFF"
  478.     $"FFFFFFFF00020000000000000003"
  479.     $"FFFFFFFFFFFF0000000000000003"
  480.     $"00007FFF7FFF7FFF0001FFFFFFFF"
  481.     $"FFFF00020000000000000003FFFF"
  482.     $"FFFFFFFF00D80100000E00000000"
  483.     $"0000FFFFFFFFFFFF000000E10000"
  484.     $"0009000000000000FFFFFFFFFFFF"
  485.     $"000000E800000009000000000000"
  486.     $"FFFFFFFFFFFF000000EF00000009"
  487.     $"000000000000FFFFFFFFFFFF0000"
  488.     $"00F600000009000000000000FFFF"
  489.     $"FFFFFFFF00000850616C6174696E"
  490.     $"6F0647656E6576610647656E6576"
  491.     $"610647656E6576610647656E6576"
  492.     $"61"
  493. };
  494.  
  495. resource 'DLOG' (kErrorBoxID, "Cappuccino Error Box") 
  496. {
  497.     {57, 46, 244, 374},
  498.     dBoxProc,
  499.     invisible,
  500.     goAway,
  501.     0x0,
  502.     kErrorBoxID,
  503.     "",
  504.     alertPositionParentWindowScreen
  505. };
  506.  
  507. resource 'DITL' (kErrorBoxID) 
  508. {
  509.     {    /* array DITLarray: 5 elements */
  510.         /* [1] */
  511.         {153, 256, 173, 314}, Button { enabled, "OK" },
  512.         /* [2] */
  513.         {153, 185, 173, 243}, Button { enabled, "Cancel" },
  514.         /* [3] */
  515.         {11, 70, 124, 317}, StaticText { disabled,
  516.             "<< Use this for errors in the Editor, su"
  517.             "ch as out of memory, unable to acquire s"
  518.             "ome system resource, etc.>> \nUser errors"
  519.             " use a standard alert appearance. See DI"
  520.             "TL 129.>>" },
  521.         /* [4] */
  522.         {11, 19, 43, 51}, Icon { disabled, kEditorIconPicture },
  523.         /* [5] */
  524.         {149, 252, 177, 318}, UserItem { disabled }
  525.     }
  526. };
  527.  
  528.  
  529. //------------------------------------------------------------------------------
  530. // Settings dialog resources
  531. //------------------------------------------------------------------------------
  532.     // The resources for the dialog "kSettingsDialogID" can be found in the
  533.     // Cappuccino.rsrc file, since they are graphically oriented.
  534.  
  535. #define Geneva        3
  536.  
  537. resource 'finf' (kDialogFontInfoID, "Dialog Font Info") 
  538. {
  539.     {    /* array Fonts: 1 element */
  540.         /* [1] */
  541.         Geneva, plain, 10,
  542.     }
  543. };
  544.  
  545. //------------------------------------------------------------------------------
  546. // Menu Resource
  547. //------------------------------------------------------------------------------
  548.  
  549. resource 'MENU' (kMiscMenuID) 
  550. {
  551.     kMiscMenuID,
  552.     textMenuProc,
  553.     0b11111111111111111111111111111101,
  554.     enabled,
  555.     "Misc",
  556.     {
  557.         "Speak",        noIcon, noKey, noMark, plain,
  558. #ifndef qViewerBuild
  559.         "-",            noIcon, noKey, noMark, plain,
  560.         "Set Text…",    noIcon, "T",   noMark, plain,
  561.         "Settings…",    noIcon, noKey, noMark, plain
  562. #endif
  563.     }
  564. };
  565.  
  566. resource 'MENU' (kFontPopupMenuID) 
  567. {
  568.     kFontPopupMenuID,
  569.     3,
  570.     allEnabled,
  571.     enabled,
  572.     "FontPopup",
  573.     {
  574.     }
  575. };
  576.  
  577. //------------------------------------------------------------------------------
  578. // Finder Bundle Information
  579. //------------------------------------------------------------------------------
  580.  
  581. resource 'BNDL' (kDocumentBundle, "Document BNDL") 
  582. {
  583.     kODShellSignature,
  584.     0,
  585.     {    /* array TypeArray: 2 elements */
  586.         /* [1] */
  587.         'FREF',
  588.         {    /* array IDArray: 2 elements */
  589.             /* [1] */
  590.             0, kDocumentFREF,
  591.             /* [2] */
  592.             1, kStationeryFREF
  593.         },
  594.         /* [2] */
  595.         'ICN#',
  596.         {    /* array IDArray: 2 elements */
  597.             /* [1] */
  598.             0, kDocumentIcons,
  599.             /* [2] */
  600.             1, kStationeryIcons
  601.         }
  602.     }
  603. };
  604.  
  605. resource 'BNDL' (kEditorBundle, "Editor BNDL") 
  606. {
  607.     kCappuccinoEditorOSType,
  608.     0,
  609.     {    /* array TypeArray: 2 elements */
  610.         /* [1] */
  611.         'FREF',
  612.         {    /* array IDArray: 1 elements */
  613.             /* [1] */
  614.             0, kEditorFREF
  615.         },
  616.         /* [2] */
  617.         'ICN#',
  618.         {    /* array IDArray: 1 elements */
  619.             /* [1] */
  620.             0, kEditorIcons
  621.         }
  622.     }
  623. };
  624.  
  625. resource 'BNDL' (kViewerBundle, "Viewer BNDL") 
  626. {
  627.     kCappuccinoViewerOSType,
  628.     0,
  629.     {    /* array TypeArray: 2 elements */
  630.         /* [1] */
  631.         'FREF',
  632.         {    /* array IDArray: 1 elements */
  633.             /* [1] */
  634.             0, kViewerFREF
  635.         },
  636.         /* [2] */
  637.         'ICN#',
  638.         {    /* array IDArray: 1 elements */
  639.             /* [1] */
  640.             0, kViewerIcons
  641.         }
  642.     }
  643. };
  644.  
  645. resource 'FREF' (kDocumentFREF) 
  646. {
  647.     kCappuccinoDocumentOSType, 0, ""
  648. };
  649.  
  650. resource 'FREF' (kStationeryFREF) 
  651. {
  652.     kCappuccinoStationeryOSType, 1, ""
  653. };
  654.  
  655. resource 'FREF' (kEditorFREF) 
  656. {
  657.     'shlb', 0, ""
  658. };
  659.  
  660. resource 'FREF' (kViewerFREF) 
  661. {
  662.     'shlb', 0, ""
  663. };
  664.  
  665. data kODShellSignature (0, "Owner resource") 
  666. {
  667.     $"00"
  668. };
  669.  
  670. data kCappuccinoViewerOSType (0, "Owner resource") 
  671. {
  672.     $"00"
  673. };
  674.  
  675. data kCappuccinoEditorOSType (0, "Owner resource") 
  676. {
  677.     $"00"
  678. };
  679.